import Cookies from 'js-cookie'
import Config from '@/settings'

// token
const TokenKey = Config.TokenKey

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}


//username
export function getUsername(username) {
  return Cookies.get("username")
}

export function setUsername(username) {
  return Cookies.set("username", username)
}

export function removeUsername() {
  return Cookies.remove("username")
}

//id
export function getId() {
  var id = Number(Cookies.get("id"))
  return id
}

export function setId(id) {
  return Cookies.set("id", id)
}

export function removeId() {
  return Cookies.remove("id")
}

//email
export function getEmail() {
  return Cookies.get("email")
}

export function setEmail(email) {
  return Cookies.set("email", email)
}

export function removeEmail() {
  return Cookies.remove("email")
}

//type
export function getType() {
  return Cookies.get("typeList").split(",").map(Number)
}

export function setType(typeList) {
  return Cookies.set("typeList", typeList)
}

export function removeType() {
  return Cookies.remove("typeList")
}


//isCommend
export function getisCommend() {
  return Cookies.get("isCommend")
}

export function setisCommend(isCommend) {
  return Cookies.set("isCommend", isCommend)
}

export function removeisCommend() {
  return Cookies.remove("isCommend")
}


